package EnrichAPI;

public class StringDemo1 {
    public static void main(String[] args) {
        // 核心目标：验证码生成器
        String code = getCode(4);
        System.out.println(code);
    }
    public static String getCode(int n){
        String code = "";
        String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        for(int i = 0; i < n; i++){
            int index = (int)(Math.random() * str.length());
            code += str.charAt(index);
        }
        return code;
    }
}
